int minDepth(struct TreeNode* root) {
    if (root == NULL)
        return 0;
    if (root->left == root->right)
    {
        return 1;
    }
    int leftdepth = minDepth(root->left);
    int rigthdepth = minDepth(root->right);
    if (leftdepth == 0)
    {
        return rigthdepth + 1;
    }
    if (rigthdepth == 0)
    {
        return leftdepth + 1;
    }
    return leftdepth > rigthdepth ? rigthdepth + 1 : leftdepth + 1;
}